// @ts-ignore
/* eslint-disable */

import { request } from '@/utils/requestWrapper';
import { tokenStore } from "@/store/tokenStore";

import type { API } from '@/backend/typings.d';

const tokenStoreInstance = tokenStore();

/** 获取当前登录用户 GET /api/user/getLoginUser */
export async function getLoginUserUsingGet(options?: { [key: string]: any }) {
  return request<API.BaseResponseLoginUserVO_>({
    url: "/api/user/getLoginUser",
    method: "GET",
    header: {
      "Content-Type": "application/json",
      "Authorization": tokenStoreInstance.getToken || null,
    },
    ...options
  });
}

/** 用户登录 POST /api/user/wxLogin */
export async function userLoginUsingPost(
  body: API.UserLoginRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseString_>({
    url: "/api/user/wxLogin",
    method: "POST",
    data: body,
    ...options
  });
}

/** 用户注册 POST /api/user/register */
export async function userRegisterUsingPost(
  body: API.UserRegisterRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseLong_>({
    url: "/api/user/register",
    method: "POST",
    data: body,
    ...options
  });
}

/** 更新用户信息 POST /api/user/update/my */
export async function updateMyUserUsingPost(
  body: API.UserUpdateMyRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>({
    url: "/api/user/update/my",
    method: "POST",
    data: body,
    header: {
      "Content-Type": "application/json",
      'Authorization': tokenStoreInstance.getToken || null
    },
    ...options
  });
}

/** 密码登录 POST /api/user/userLogin */
export async function PasswordLoginUsingPost(
  body: API.AdminLoginRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseString_>({
    url: "/api/user/userLogin",
    method: "POST",
    data: body,
    ...options
  });
}

/** 添加用户 POST /api/user/add */
export async function addUserUsingPost(
  body: API.UserAddRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseLong_>({
    url: "/api/user/add",
    method: "POST",
    data: body,
    ...options
  });
}

/** 删除用户 POST /api/user/delete */
export async function deleteUserUsingPost(
  body: API.DeleteRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>({
    url: "/api/user/delete",
    method: "POST",
    data: body,
    ...options
  });
}

/** 获取用户详情 GET /api/user/get */
export async function getUserByIdUsingGet(
  params: API.getUserByIdUsingGETParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseUser_>({
    url: "/api/user/get",
    method: "GET",
    data: params,
    ...options
  });
}

/** 获取用户VO详情 GET /api/user/get/vo */
export async function getUserVoByIdUsingGet(
  params: API.getUserVOByIdUsingGETParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseUserVO_>({
    url: "/api/user/get/vo",
    method: "GET",
    data: params,
    ...options
  });
}

/** 分页获取用户列表 POST /api/user/list/page */
export async function listUserByPageUsingPost(
  body: API.UserQueryRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponsePageUser_>({
    url: "/api/user/list/page",
    method: "POST",
    data: body,
    ...options
  });
}

/** 分页获取用户VO列表 POST /api/user/list/page/vo */
export async function listUserVoByPageUsingPost(
  body: API.UserQueryRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponsePageUserVO_>({
    url: "/api/user/list/page/vo",
    method: "POST",
    data: body,
    ...options
  });
}

/** 发送邮箱验证码 GET /api/user/login/email */
export async function emailCodeUsingGet(
  params: API.emailCodeUsingGETParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>({
    url: "/api/user/login/email",
    method: "GET",
    data: params,
    ...options
  });
}

/** 邮箱登录 POST /api/user/login/email */
/*export async function userLoginByEmailUsingPost(
  body: API.UserLoginByEmailRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseLoginUserVO_>({
    url: "/api/user/login/email",
    method: "POST",
    data: body,
    ...options
  });
}*/

/** 用户退出登录 POST /api/user/logout */
export async function userLogoutUsingPost(options?: { [key: string]: any }) {
  return request<API.BaseResponseBoolean_>({
    url: "/api/user/logout",
    method: "POST",
    ...options
  });
}

/** 更新用户 POST /api/user/update */
export async function updateUserUsingPost(
  body: API.UserUpdateRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>({
    url: "/api/user/update",
    method: "POST",
    data: body,
    ...options
  });
}
